exports.main = async (event, context) => {
	const headName = 'im-going-up-the-wall-'
	// 解构赋值获取前端数据
	const {
		name,
		age
	} = event
	//返回数据类型
	const result = {
		code: 0,
		msg: "",
		data: {}
	}
	// 获取云云数据库实例对象
	const db = uniCloud.database();
	// 云函数向数据库中插入数据
	let res = await db.collection(headName + "userList").add({
		username: name,
		age: age
	})
	if (res.id) {
		result.code = 1
		result.msg = "添加数据成功"
		result.data = {
			username: name,
			age: age
		}
	} else {
		result.code = -1
		result.msg = "添加数据失败"
		result.data = {
			username: name,
			age: age
		}
	}
	//返回数据给客户端
	return result
};